﻿﻿<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css" />
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>背景图管理</title>
	<style>
		.page li{
			font-size: 30px;
			display: inline-block;
			margin-left: 5px;
		}
		.page{
			width:100%;
			height:25px;
			margin:0 auto;
		}
		.page ul{
			text-align: center;
		}
		td.background_url img{
			width: 300px;
		}
	</style>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 背景图管理 <span class="c-gray en">&gt;</span> 背景图列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">

	<div class="cl pd-5 bg-1 bk-gray mt-20" style="display: none"> <span class="l"><button style="" class="btn radius btn-primary size-s" onClick="modaldemo()">添加</button></span>  </div>
	<div class="mt-20">
		<table class="table table-border table-bordered table-bg table-hover table-sort">
			<thead>
				<tr class="text-c">
					<th width="80">ID</th>
					<th width="80">页面</th>
					<th width="80">描述</th>
					<th width="180">图片</th>
					<th width="40">操作</th>
				</tr>
			</thead>
			<tbody>
			@foreach($backgrounds as $result)
				<tr class="text-c">
					<td class="background_id">{{$result->id}}</td>
					<td class="background_page">{{$result->page}}</td>
					<td class="background_description">{{$result->description}}</td>
					<td class="background_url"><img src="../{{$result->url}}" alt=""/></td>
					<td class="f-14 td-manage">
						<a style="text-decoration:none" title="修改" onClick="modalupdate($(this))"><i class="Hui-iconfont">&#xe6df;</i></a>
					</td>
				</tr>
			@endforeach




			</tbody>
		</table>

		<div class="page">
			{!! $backgrounds->links() !!}
		</div>

	</div>
	<div id="modal-demo" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content radius">
				<div class="modal-header">
					<h3 class="modal-title">添加</h3>
					<a class="close" data-dismiss="modal" aria-hidden="true" href="javascript:void();">×</a>
				</div>
					<form action="/admin/addBackground" method="post" enctype="multipart/form-data">
						<div class="modal-body">
							<lable>背景图页面</lable>
							<input type="text" class="input-text radius"  name="background_page">
							<lable>背景图描述</lable>
							<input type="text" class="input-text radius" name="background_description" style="margin-bottom: 15px;">

							<lable>背景图图片</lable>
							<input type="file" class="" name="background_img">
							<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
						</div>
						<div class="modal-footer">
							<input type="submit" class="btn btn-primary" value="确定">
							<button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
						</div>

					</form>

			</div>
		</div>
	</div>
	<div id="modal-update" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content radius">
				<div class="modal-header">
					<h3 class="modal-title">修改</h3>
					<a class="close" data-dismiss="modal" aria-hidden="true" href="javascript:void();">×</a>
				</div>
				<form action="/admin/updateBackground" method="post" enctype="multipart/form-data">
					<div class="modal-body">
						<input type="hidden" class="input-text radius"  name="background_id" value="" id="background_id">
						<lable>背景图页面</lable>
						<input type="text" class="input-text radius"  name="background_page" id="background_page" readonly disabled>
						<lable>背景图描述</lable>
						<input type="text" class="input-text radius" name="background_description" style="margin-bottom: 15px;" id="background_description" readonly disabled>

						<lable>背景图图片</lable>
						<input type="file" class="" name="background_img" accept="image/gif,image/png,image/jpeg">
						<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
					</div>
					<div class="modal-footer">
						<input type="submit" class="btn btn-primary" value="确定">
						<button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
					</div>

				</form>

			</div>
		</div>
	</div>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script>
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">


function modaldemo(){
    $("#modal-demo").modal("show")
}
function modalupdate($this){
   //console.log($this);
    //$("#modal-update").modal("show");
    $("#modal-update").modal("show");
    var value = $this.parents('tr').find('.background_id').html();

	var page = $this.parents('tr').find('.background_page').html();

	var description = $this.parents('tr').find('.background_description').html();

    $('#background_id').val(value);
	$('#background_page').val(page);
	$('#background_description').val(description);
}

</script> 
</body>
</html>